package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.AppPackageManage;
import com.sc.nft.entity.MallMember;
import com.sc.nft.entity.vo.AppPackageManageGetByNameVO;
import com.sc.nft.entity.vo.appPackageManage.AppPackManageAdminPageVO;
import com.sc.nft.mapper.AppPackageManageMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;


/**
 * (AppPackageManage)表Dao层
 *
 */
@Slf4j
@Repository
public class AppPackageManageDao extends ServiceImpl<AppPackageManageMapper, AppPackageManage> {

    public Page<AppPackManageAdminPageVO> adminPage(String name, Integer pageNo, Integer pageSize) {
        return baseMapper.adminPage(new Page(pageNo, pageSize), name);
    }

    public void updateButton(Long id, Boolean isOpen) {
        UpdateWrapper<AppPackageManage> wrapper = new UpdateWrapper<>();
        wrapper.eq("id", id);
        wrapper.set("open", isOpen);
        update(new AppPackageManage(), wrapper);
    }

    public AppPackageManageGetByNameVO getByName(String sourcePackageName) {
        return baseMapper.getByName(sourcePackageName);
    }
}
